package com.tech.zhidengxian.controller;

import com.tech.zhidengxian.model.dto.UserDTO;
import com.tech.zhidengxian.model.dto.result.ReturnResult;
import com.tech.zhidengxian.model.dto.result.ReturnResultUtils;
import com.tech.zhidengxian.service.api.UserService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;
    @RequestMapping("/pwdLogin")
    public ReturnResult<UserDTO> pwdLogin(@RequestBody UserDTO userDTO){
        return ReturnResultUtils.returnSuccess(userService.pwdLogin(userDTO));
    }

    @RequestMapping("/register")
    public ReturnResult<UserDTO> register(@RequestBody UserDTO userDTO){
        return ReturnResultUtils.returnSuccess(userService.register(userDTO));
    }
}
